/*
 * @lc app=leetcode.cn id=2248 lang=cpp
 *
 * [2248] 多个数组求交集
 */
#include <map>
#include<vector>
#include <iostream>
using namespace std;
// @lc code=start
class Solution {
public:
    vector<int> intersection(vector<vector<int>>& nums) {
        auto mp =map<int,int>();
        for (int i=0;i<nums.size();i++){
            for (int j=0;j<nums[i].size();++j){
                mp[nums[i][j]]++;
            }
        }
        auto arr=vector<int>();
        for ( auto p =mp.begin();p!=mp.end();p++){
            if(p->second==nums.size()){
                arr.push_back(p->first);
            }
        }
        sort(arr.begin(),arr.end());
        return arr;
    }
};
// @lc code=end

